home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-06-15 | 3.0 KB | 152 lines | [TEXT/CWIE] |
- /*
-
- File: EmptyWindow.cp
- Project: Sample code for Sprocket Framework 1.1 (DR2), released 6/15/96
- Contains: A window which does nothing at all, for you to build upon
- To Do: Look at Window.h to see the other functionality you can override
-
-
- Sprocket Major Contributors:
- ----------------------------
- Dave Falkenburg, producer of Sprocket 1.0
- Bill Hayden, producer of Sprocket 1.1
- Steve Sisak, producer of the upcoming Sprocket 2.0
-
- Pete Alexander Steve Falkenburg Randy Thelen
- Eric Berdahl Nitin Ganatra Chris K. Thomas
- Marshall Clow Dave Hershey Leonard Rosenthal
- Tim Craycroft Dave Mark Dean Yu
- David denBoer Gary Powell
- Cameron Esfahani Jon Summers Apple Computer, Inc.
-
- Comments, Additions, or Corrections:
- ------------------------------------
- Bill Hayden, Nikol Software <nikol@codewell.com>
-
- */
-
-
-
- #include "EmptyWindow.h"
- #include "SprocketConstants.h"
-
-
- extern TMenuBar* gMenuBar; // you will need this when you start adjusting menus
- // based on what's going on with your window
-
-
- // methods
-
- TEmptyWindow::TEmptyWindow()
- {
- this->CreateWindow(); // kNormalWindow is default. Method inherited from TWindow
- // TWindow::CreateWindow() calls our MakeNewWindow().
- }
-
-
-
- /**********************************************************************************/
-
-
-
- TEmptyWindow::~TEmptyWindow()
- {
- // No particular cleanup in this version, since our real purpose was
- // just to demonstrate Sprocket.
-
- gMenuBar->EnableCommand( cClose, false ); // in case we are the only window open
- }
-
-
-
- /**********************************************************************************/
-
-
-
- WindowRef TEmptyWindow::MakeNewWindow( WindowRef behindWindow )
- {
- WindowRef aWindow;
- GrafPtr savedPort;
-
- GetPort(&savedPort);
-
- aWindow = GetNewColorOrBlackAndWhiteWindow( 1000, nil, behindWindow );
-
- if (aWindow)
- {
- SetPortWindowPort(aWindow);
-
- ShowWindow(aWindow);
- }
-
- SetPort(savedPort);
-
- return aWindow;
- }
-
-
-
- /**********************************************************************************/
-
-
-
- void TEmptyWindow::Draw(void)
- {
- // Draw your window contents here.
-
-
- // This window is resizable, so draw the resize box
-
- EraseRect(&this->fWindow->portRect);
- DrawJustTheGrowIcon(this->fWindow);
- }
-
-
-
- /**********************************************************************************/
-
-
-
- void TEmptyWindow::Activate( Boolean activating )
- {
- #pragma unused(activating)
- // Handle a window activate here.
- }
-
-
-
- /**********************************************************************************/
-
-
-
-
- void TEmptyWindow::AdjustMenusBeforeMenuSelection(void)
- {
- // Setup your menus before the user sees them, using calls such as this:
-
- gMenuBar->EnableCommand( cClose, true ); // users need to be able to close us
- }
-
-
-
-
- /**********************************************************************************/
-
-
-
-
- Boolean TEmptyWindow::DoCommand(CommandID theCommand)
- {
- switch(theCommand)
- {
- // Handle your commands here via case statements.
-
- default:
- return TWindow::DoCommand(theCommand);
- break;
- }
-
- return true;
- }
-
-